/*index.js 文件*/
 
// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	
// #endif
 
// #ifdef VUE3
import { createStore } from 'vuex'
 
const store = createStore({ //需要使用 vue3 的方式创建啦~~~
// #endif
	state: {
		selectedIndex: 0,
		selectedColor: 'green', //选中颜色
		color: 'black', //默认颜色
		list: [{
				pagePath: "/pages/Home/Home",
				iconPath: "/static/logo.png",
				selectedIconPath: "/static/my.png",
				text: "Home",
				title: '云录音',
				iconName: "wap-home",
				selectedIconName: "wap-home-o"
			},
			{
				pagePath: "/pages/List/List",
				iconPath: "/static/logo.png",
				selectedIconPath: "/static/my.png",
				text: "List",
				title: '录音表',
				iconName: "wap-nav",
				selectedIconName: "wap-nav"
			},
			{
				pagePath: "/pages/My/My",
				iconPath: "/static/logo.png",
				selectedIconPath: "/static/my.png",
				text: "My",
				title: '',
				iconName: "contact",
				selectedIconName: "contact-o"
			}
		],
		isLogin: false,
		isShowTabBar: true,
		/*
			约定俗成参数约定：
			name: 命名 string,
			time: 时间 string,
			date: 年月日 string,
			tempFilePath: 音频本地缓存绝对 URL
		*/
		audioFileList: []
		// audioFileList: [{
		// 	name: 'Test',
		// 	time: '00:00.00',
		// 	date: '2024/6/20',
		// 	tempFilePath: null
		// }, {
		// 	name: 'Test',
		// 	time: '00:00.00',
		// 	date: '2024/6/20',
		// 	tempFilePath: null
		// }, {
		// 	name: 'Test',
		// 	time: '00:00.00',
		// 	date: '2024/6/20',
		// 	tempFilePath: null
		// }, {
		// 	name: 'Test',
		// 	time: '00:00.00',
		// 	date: '2024/6/20',
		// 	tempFilePath: null
		// }, {
		// 	name: 'Test',
		// 	time: '00:00.00',
		// 	date: '2024/6/20',
		// 	tempFilePath: null
		// }]
	},
	mutations: {
		changeSelected(state, value) {
			state.selectedIndex = value
		},
		changeLogin(state, value) {
			state.isLogin = value
		},
		pushAudioFile(state, item) {
			state.audioFileList.push(item)
		}
	},
	actions: {
		
	},
	modules: {}
})

//监听属性变更
store.subscribe((mutation, state) => {
	switch (mutation.type) {
		case 'changeSelected': //监听页面索引
			
			break;
		case 'changeLogin': //监听登录状态
			
			break;
	}
});
store.subscribeAction((action, state) => {
	
});
 
export default store